// #include <algorthm>
// #include <iostream>
#pragma once

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <filesystem>
#include <cctype>
#include <algorithm>


namespace fs = std::filesystem;

class convertor{
public:
    convertor();
    ~convertor();
private:
    unsigned int totalLine;
    unsigned int lineLimit = 0;
    void setLineLimit(int limit);
    bool isWhitespaceOnly(const std::string& line);
    bool isAllmanLeftBraceLine(const std::string& line);
    std::vector<std::string> convertAllmanToKnr(
        const std::vector<std::string>& inputLines);

    bool readFileLines(const std::string& filename, 
        std::vector<std::string>& lines);
    bool writeFileLines(const std::string& filename, 
        const std::vector<std::string>& lines);

    bool isCppOrCFile(const std::string& filename);

    bool processFile(const std::string& filename,
        bool mode_replace = true);
};